<script type="text/javascript">
	$(document).ready(function(){

		
	});
	function check_submit()
	{
		$('#save_post').submit();
	}
	function chane_tab(value)
	{
		if(value == '1')
		{
			$('.tong_quat').toggle('slow');
			$('.du_lieu').hide();
			$('.hinh_anh').hide();
		}
		if(value == '2')
		{
			$('.tong_quat').hide();
			$('.du_lieu').toggle('slow');
			$('.hinh_anh').hide();
			
		}
		if(value == '3')
		{
			$('.tong_quat').hide();
			$('.du_lieu').hide();
			$('.hinh_anh').toggle('slow');
			
		}
	}
	
	$(function() {
		$( "#created" ).datepicker();
	});
</script>
<div>
	<div class="content_navigation">
		<div class="content_post_title pt14">
			<div class="button left" onclick='location.href="<?=base_url().'admin/'.$module.'/'?>"'>Back</div>
			<div class="button left" onclick="return chane_tab('1');">Tổng quát</div>
			<div class="button left" onclick="return chane_tab('2');">Dữ liệu</div>
			<div class="button left" onclick="return chane_tab('3');">Hình ảnh</div>
			<div class="clearAll"></div>
		</div>
		<div class="content_post_action pt14">
			<div class="button left" onclick="return check_submit();">Save</div> 
			<div class="button left" onclick="location.href='<?=base_url().'admin/'.$module.'/save_exit'?>'">Save & Exit</div>
			<div class="button left" onclick="location.href='<?=base_url().'admin/'.$module.'/'?>'">Cancel</div>
		</div>
		<div class="clearAll"></div>
	</div>
	<div class="content_main_box">
		<form action="<?=base_url().'admin/'.$module.'/save'?>" method="POST" enctype="multipart/form-data" name="save_post" id="save_post">
		<input type="hidden" name="hidden_id" value="<?=!empty($result['id'])?$result['id']:0?>" />
		<!-- BEGIN tổng quát -->
		<div class="tong_quat">
			<div class="content_main_content">
				<div class="wrap_box_input">
					<div class="wrap_text">Nane:</div>
					<div class="wrap_input">
						<input type="text" name="name" id="name" class="input mt3" value="<?=!empty($result['name'])?$result['name']:''?>" placeholder="Tên của sản phẩm."/>	
					</div>
					<div class="clearall"></div>
				</div>
				<div class="" style="height:auto;padding-bottom:15px;">
					<div class="main_text">Intro:</div>
					<div class="main_input">
						<textarea class="main_input_text" class="" style="height:auto;" name="intro" id="intro" cols="20" rows="20"><?=!empty($result['intro'])?parserEditorHTML($result['intro']):''?></textarea>		
					<script type="text/javascript">
						var ROOT = '<?=base_url()?>';
						var oEdit2 = new InnovaEditor("oEdit2");
						oEdit2.width = "753px";
						oEdit2.cmdAssetManager="modalDialogShow('"+ROOT+"static/editor/assetmanager/assetmanager.php',640,445);";
						oEdit2.REPLACE("intro");
					</script>
					</div>
					<div class="clearall"></div>
				</div>
				<div class="" style="height:auto;padding-bottom:15px;">
					<div class="main_text">Content:</div>
					<div class="main_input">
						<textarea class="main_input_text" class="" style="height:auto;" name="content" id="content" cols="20" rows="20"><?=!empty($result['content'])?parserEditorHTML($result['content']):''?></textarea>		
					<script type="text/javascript">
						var ROOT = '<?=base_url()?>';
						var oEdit1 = new InnovaEditor("oEdit1");
						oEdit1.width = "753px";
						oEdit1.cmdAssetManager="modalDialogShow('"+ROOT+"static/editor/assetmanager/assetmanager.php',640,445);";
						oEdit1.REPLACE("content");
					</script>
					</div>
					<div class="clearall"></div>
				</div>
			</div>
		</div>
		<!-- END Tổng quát -->
		<!-- BEGIN Dư lieu -->
		<div class="du_lieu" style="display:none;height:auto;padding-bottom:15px;">
			<div class="content_main_content">
				<div class="wrap_box_input">
					<div class="wrap_text">Active:</div>
					<div class="wrap_input">
						<input type="checkbox" name="status" id="status" class="mt11" 
						<?php if(isset($result['status'])){if($result['status'] == 1){?> checked="checked" <?php }}else{?> checked="checked" <?php } ?>/>			   	   
					</div>
					<div class="clearAll"></div>
				</div>
				<div class="wrap_box_input">
					<div class="wrap_text">Parent id:</div>
					<div class="wrap_input">
						<input type="text" name="parent_id" id="parent_id" class="input mt3" value="<?=!empty($result['parent_id'])?$result['parent_id']:''?>" placeholder="Parent id."/>	
					</div>
					<div class="clearAll"></div>
				</div>
				<div class="wrap_box_input">
					<div class="wrap_text">Slug:</div>
					<div class="wrap_input">
						<input type="text" name="slug" id="slug" class="input mt3" value="<?=!empty($result['slug'])?$result['slug']:''?>" placeholder="Seo link."/>	
					</div>
					<div class="clearAll"></div>
				</div>
				<div class="wrap_box_input">
					<div class="wrap_text">Order:</div>
					<div class="wrap_input">
						<input type="text" name="order" id="order" class="input mt3" value="<?=!empty($result['order'])?$result['order']:''?>" placeholder="Sắp xếp thứ tự xuất hiện sản phẩm."/>	
					</div>
					<div class="clearAll"></div>
				</div>
				<div class="wrap_box_input">
					<div class="wrap_text">View count:</div>
					<div class="wrap_input">
						<input type="text" name="view_count" id="view_count" class="input mt3" value="<?=!empty($result['view_count'])?$result['view_count']:''?>" placeholder="Tổng số lượt xem."/>	
					</div>
					<div class="clearAll"></div>
				</div>
				<div class="wrap_box_input">
					<div class="wrap_text">Author:</div>
					<div class="wrap_input">
						<input type="text" name="author" id="author" class="input mt3" value="<?=!empty($result['author'])?$result['author']:''?>" placeholder="Tác giả."/>	
					</div>
					<div class="clearAll"></div>
				</div>
			</div>
		</div>
		<!-- END Dữ liệu -->
		<!-- BEGIN Hình ảnh -->
		<div class="hinh_anh" style="display:none;height:auto;padding-bottom:15px;">
			<div class="content_main_content">
				<div class="wrap_box_input">
					<div class="wrap_text">Image thumb:</div>
					<div class="wrap_input" style="width:532px;">
						<input type="file" name="image_thumb" id="image_thumb" class="mt3"/>		
					</div>
					<div class="wrap_input" style="padding-top:2px;">
						<?php 
						if(isset($result['thumb']))
						{
						?>
							<img src="<?=base_url().IMAGE_THUMB_DIR.$result['thumb']?>" alt="" width="56px;" height="56x;"/>		
						<?php } ?>			  
					</div>
					<div class="clearall"></div>
				</div>
			</div>
		</div>
		<!-- END Hình ảnh -->
		</form>
	</div>
</div>